import os
import datetime
from plugin import PyoCDVD_Plugin


class Filesystem(PyoCDVD_Plugin):
    '''Extracts the 'size' and 'date' metadata.'''

    def process_file(self, filepath):
        # Get size
        size = int(os.path.getsize(filepath))
        # Get date
        date_string = os.path.getctime(filepath)
        date = datetime.datetime.fromtimestamp(date_string).isoformat()
        return {'size': size,
                'date': date}